unit uImagePanel;

interface

uses
  Classes, Controls, ExtCtrls, StdCtrls, Graphics, Forms;

type
  TImagePanel = class(TPanel)
  private
    FImage: TImage;
    FCountryImage: TImage;
    FPlayerName: TLabel;
    FPlayerStatus: TLabel;
  protected
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;

  published
    property Image: TImage read FImage write FImage;
    property PlayerName: TLabel read FPlayerName write FPlayerName;
    property PlayerStatus: TLabel read FPlayerStatus write FPlayerStatus;
    property CountryImage: TImage read FCountryImage write FCountryImage;

  end;

procedure Register;

implementation

// uses Themes;

procedure Register;
begin
  RegisterComponents('LPM', [TImagePanel]);
end;

destructor TImagePanel.Destroy;
begin
  FImage.Free;
  FPlayerName.Free;
  FPlayerStatus.Free;
  FCountryImage.Free;
  inherited Destroy;
end;

constructor TImagePanel.Create(AOwner: TComponent);
begin
  Inherited;
  self.DoubleBuffered := true;
  FImage := TImage.Create(self);
  FImage.Parent := self;
  FImage.Align := alClient;
  FImage.Visible := true;
  FImage.Center := true;
  FImage.Stretch := true;
  FImage.Proportional := true;
  FImage.Transparent := true;
  // -----
  FPlayerStatus := TLabel.Create(self);
  FPlayerStatus.Parent := self;
  FPlayerStatus.Visible := true;
  FPlayerStatus.Alignment := taCenter;
  FPlayerStatus.left := 0;
  FPlayerStatus.width := width;
  FPlayerStatus.top := 0;
  FPlayerStatus.Anchors := [akLeft, akRight, akTop];
  FPlayerStatus.HEIGHT := FImage.HEIGHT;
  FPlayerStatus.AutoSize := false;
  FPlayerStatus.Font.Color := clYellow;
  FPlayerStatus.Font.Size := 10;
  FPlayerStatus.WordWrap := true;
  FPlayerStatus.Caption := '';
  FPlayerStatus.Transparent;
  FPlayerStatus.BringToFront;
  // ----
  FPlayerName := TLabel.Create(self);
  FPlayerName.Parent := self;
  FPlayerName.Alignment := taCenter;
  FPlayerName.Visible := true;
  FPlayerName.Font.Color := clwhite;
  FPlayerName.Font.Size := 8;
//  FPlayerName.WordWrap := true;
  FPlayerName.Align := albottom;
  FPlayerName.Caption := ' ';
  FPlayerName.Transparent := true;
  self.BevelOuter := bvNone;
  // ----
  FCountryImage := TImage.Create(self);
  FCountryImage.Parent := self;
  FCountryImage.width := width div 6;
  FCountryImage.HEIGHT := FCountryImage.width div 4 * 3;
  FCountryImage.left := width - FCountryImage.width;
  FCountryImage.top := HEIGHT - FPlayerName.HEIGHT - FCountryImage.HEIGHT;
  FCountryImage.Anchors := [akRight, akBottom];
  FCountryImage.Visible := true;
  FCountryImage.Center := true;
  FCountryImage.Stretch := true;
  FCountryImage.Proportional := true;
  FCountryImage.Transparent := true;
  Caption := '';
  self.Refresh;
end;

end.
